#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n;
    cin>>n;
    vector<int>v(n+1);
    for(int i=1;i<=n;i++)cin>>v[i];
    int m;
    cin>>m;
    while(m--)
    {
        int l,r;
        cin>>l>>r;
        //int x=v[l];
        bool f=0;
        for(;l<=r;l++)
        {
            if(!f)
            {
                cout<<v[l]<<" ";
                f=1;
            }
            else cout<<v[l]-v[l-1]<<" ";
        }
        cout<<endl;
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T=1;
    //cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}